#ifndef __OLED_H__
#define __OLED_H__

#include "bsp_oled_io.h"

#define OLED_128X96     0
#define OLED_128X128    1

#define OLED_COLOR_RGB  0
#define OLED_COLOR_BGR  1

//#define OLED_TYPE       OLED_128X96
#define OLED_TYPE       OLED_128X128

#define OLED_COLOR      OLED_COLOR_BGR

#if OLED_TYPE==OLED_128X96
  #define IMAGE_WIDTH     128                 
  #define IMAGE_HEIGHT    96
#else
  #define IMAGE_WIDTH     128                 
  #define IMAGE_HEIGHT    128
#endif

#define OLED_COLOR_MASK_R(r)    ((r)>>2)
#define OLED_COLOR_MASK_G(g)    ((g)>>2)
#define OLED_COLOR_MASK_B(b)    ((b)>>2)

void drv_oled_init();
void drv_oled_enter_sleep();
void drv_oled_exit_sleep();
void drv_oled_set_contrast(uint8_t val);
void drv_oled_set_write_area(uint8_t col,uint8_t col_end,uint8_t row,uint8_t row_end);

void drv_oled_write_ram_enter();
void drv_oled_write_ram_sync(const uint8_t *pData,uint32_t len);
void drv_oled_write_ram_async(const uint8_t *pData,uint32_t len);
uint32_t drv_oled_check_async_complete(void);
void drv_oled_wait_async_complete(void);

void drv_oled_update_screen_async(const uint8_t *pDataDMA,uint16_t len);

void drv_oled_draw_bmp(const unsigned char *bmp);

void drv_oled_set_color(uint8_t r,uint8_t g,uint8_t b);
void drv_oled_draw_line(uint8_t x,uint8_t y,uint8_t width,uint8_t height);
void drv_oled_fill_screen(uint8_t r,uint8_t g,uint8_t b);
void drv_oled_draw_rec(uint8_t x,uint8_t y,uint8_t width,uint8_t height,uint8_t thickness);
void drv_oled_draw_circle(uint8_t x,uint8_t y,uint8_t r,uint8_t thickness);

#endif

